<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="https://cdn.bootcss.com/wangEditor/10.0.13/wangEditor.min.js"></script>
<body>
<div id="editor">
  <p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
</div>
<button type="button" class="layui-btn" onclick="getHtmlContent()">获取HTML内容</button>
<button type="button" class="layui-btn" onclick="getTextContent()">获取TEXT内容</button>


</body><script >
    let E = window.wangEditor;
    let editor = new E("#editor");
    editor.create();
    function getHtmlContent() {
        alert(editor.txt.html());
    }

    function getTextContent() {
        alert(editor.txt.text());
    }
</script>
</html>